package com.easyUploader.entity.factory;

import com.easyUploader.entity.dao.Bucket;
import com.easyUploader.entity.dto.BucketDto;
import com.easyUploader.entity.vo.BucketVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author 大忽悠
 * @create 2022/11/1 10:40
 */
public class BucketFactory {
    public static final BucketConverter BUCKET_CONVERTER= Mappers.getMapper(BucketConverter.class);

    @Mapper
    public interface BucketConverter{
        @Mappings({
                @Mapping(target = "id",ignore = true),
                @Mapping(target = "createBy",ignore = true),
                @Mapping(target = "updateBy",ignore = true),
                @Mapping(target = "createTime",ignore = true),
                @Mapping(target = "updateTime",ignore = true)
        })
        Bucket toBucket(BucketVo bucketVo);
        @Mappings({
                @Mapping(target = "fileDtoList",ignore = true),
        })
        List<BucketDto> toListBucketDto(List<Bucket> bucket);
    }
}
